package com.ecarx.vhaltests;

import static com.ecarx.xui.adaptapi.car.vehicle.IDriveMode.DM_FUNC_DRIVE_MODE_SELECT;
import static org.junit.Assert.assertNotNull;

import android.car.Car;
import android.car.VehicleAreaType;
import android.car.hardware.property.CarPropertyManager;
import android.car.input.CarInputManager;
import android.content.Context;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import com.ecarx.xui.adaptapi.car.IWrapper;

import org.junit.Assert;
import org.junit.runner.RunWith;


/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class VhalKeyInputUnitTestBase {
    public static CarPropertyManager mCarPropertyMgr;
    public static CarInputManager mCarInputManager;
    private static Car mCar;
    public static Context mContext;
    public static int DELAY_GETTING_TIME = 100;

    static {
        mContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
        mCar = Car.createCar(mContext);
        assertNotNull("Car keyinput instance is null", mCar);
        mCarPropertyMgr = (CarPropertyManager) mCar.getCarManager(Car.PROPERTY_SERVICE);
        mCarInputManager = (CarInputManager) mCar.getCarManager(Car.CAR_INPUT_SERVICE);
        assertNotNull("CarPropertyMgr is null", mCarPropertyMgr);
        assertNotNull("CarInputManager is null", mCarInputManager);
    }

    public static void delay() {
        try {
            Thread.sleep(DELAY_GETTING_TIME);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void delay(int time) {
        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}